module ActsAsDynamic
  module Helpers
  
    def assert_list(klass, list, elements)
      assert_equal elements.size, list.size, list.join(' - ')
      elements.each do |nombre_elem|
        array = klass.to_s.pluralize.downcase
        assert list.include?(send(array, nombre_elem)), list.join(' - ')
      end
    end
    
    def assert_filter(name, elements)
      get :index, :filter => name, :no_paginate => 1
      assert_response :success
      list = assigns(@controller.model_name.to_s.pluralize.to_sym)
      assert_list @controller.model_class, list, elements
    end
    
  end
end

Test::Unit::TestCase.send :include, ActsAsDynamic::Helpers
